package org.example.entity;

import org.apache.commons.lang3.StringUtils;
import org.example.exception.StudentCreateException;

import java.util.HashSet;
import java.util.Set;

public class Student {

    private String studentId;

    private String studentName;


    public Student() {
    }

    public Student(String studentId, String studentName) {
        if (isIllegal(studentId, studentName)) {
            throw new StudentCreateException("学生学号姓名不能为空！");
        }
        this.studentId = studentId;
        this.studentName = studentName;
    }

    //TODO 使用StringUtils类
    public boolean isIllegal(String studentId, String studentName) {
        return StringUtils.isBlank(studentId) && StringUtils.isBlank(studentName);
    }

    public void fillNewData(Student student) {
        this.studentId = student.getStudentId();
        this.studentName = student.getStudentName();
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    @Override
    public String toString() {
        return "Student{" +
                "studentId='" + studentId + '\'' +
                ", studentName='" + studentName + '\'' +
                '}';
    }
}
